package dcc.service;

import dcc.model.FolkSpecialPeopleInfo;
import dcc.persistence.FolkSpecialPeopleMapper;

public class FolkSpecialPeopleService extends BaseService {

	public FolkSpecialPeopleService() {
		super(FolkSpecialPeopleService.class);
	}

	private FolkSpecialPeopleMapper folkSpecialPeopleMapper;

	public void setFolkSpecialPeopleMapper(
			FolkSpecialPeopleMapper folkSpecialPeopleMapper) {
		this.folkSpecialPeopleMapper = folkSpecialPeopleMapper;
	}

	public void save(FolkSpecialPeopleInfo folkSpecialPeopleInfo) {
		if (folkSpecialPeopleInfo.getId() == 0) {
			insert(folkSpecialPeopleInfo);
		} else {
			update(folkSpecialPeopleInfo);
		}
	}

	private void insert(FolkSpecialPeopleInfo folkSpecialPeopleInfo) {
		folkSpecialPeopleMapper.insert(folkSpecialPeopleInfo);
	}

	private void update(FolkSpecialPeopleInfo folkSpecialPeopleInfo) {
		folkSpecialPeopleMapper.update(folkSpecialPeopleInfo);
	}

	public FolkSpecialPeopleInfo getFolkSpecialPeopleInfoByBaseId(
			int baseId) {
		return folkSpecialPeopleMapper.getFolkSpecialPeopleInfoByBaseId(baseId);
	}
}
